<?php


namespace App\Models\Business;

use App\Models\Api\Files;
use App\Models\User\Collection;
use Illuminate\Database\Eloquent\Model;

class Business extends Model
{
    protected $table = 'business';
    protected $fillable = ['id','name','user_status','user_name','password','phone','address','business_class','cost','consumption','body','status','show_image','display_show','Business_license'];
    public function food(){
        return $this->hasMany(Food::class,'business_id','id')->with('category');
    }
    public function time(){
        return $this->hasMany(BusinessTime::class,'business_id','id');
    }
    public function shop_image(){
        return $this->belongsTo(Files::class,'shop_image','id');
    }
    public function Business_license(){
        return $this->belongsTo(Files::class,'business_license','id');
    }
    public function display_show(){
        return $this->hasMany(BusinessImage::class,'business_id','id')->with('image');
    }
    public function classification(){
        return $this->hasMany(BusinessClassificationHe::class,'business_id','id')->with('class');
    }
    public function  collection(){
        return $this->hasMany(Collection::class,'business_id','id');
    }
}
